MtEmber_Summit_MapScripts:: @ 8163AFC
@	map_script MAP_SCRIPT_ON_TRANSITION, MtEmber_Summit_OnTransition
@	map_script MAP_SCRIPT_ON_RESUME, MtEmber_Summit_OnResume
	.byte 0

MtEmber_Summit_OnResume:: @ 8163B07
@	call_if_set FLAG_SYS_SPECIAL_WILD_BATTLE, MtEmber_Summit_EventScript_TryRemoveMoltres
	end

MtEmber_Summit_EventScript_TryRemoveMoltres:: @ 8163B11
@	specialvar VAR_RESULT, GetBattleOutcome
@	compare VAR_RESULT, B_OUTCOME_CAUGHT
@	goto_if_ne EventScript_Return
@	removeobject VAR_LAST_TALKED
@	return

MtEmber_Summit_OnTransition:: @ 8163B25
@	call_if_unset FLAG_FOUGHT_MOLTRES, MtEmber_Summit_EventScript_ShowMoltres
	end

MtEmber_Summit_EventScript_ShowMoltres:: @ 8163B2F
@	clearflag FLAG_HIDE_MOLTRES
@	return

MtEmber_Summit_EventScript_Moltres:: @ 8163B33
@	goto_if_questlog EventScript_ReleaseEnd
@	special QuestLog_CutRecording
@	lock
	faceplayer
	setwildbattle SPECIES_MOLTRES, 50, ITEM_NONE
	waitse
	playmoncry SPECIES_MOLTRES, 2
	message Text_Gyaoo
	waitmessage
	waitmoncry
	delay 10
	playbgm MUS_RG_ENCOUNTER_GYM_LEADER, 0
	waitbuttonpress
@	setflag FLAG_SYS_SPECIAL_WILD_BATTLE
	special BattleSetup_StartLegendaryBattle
	waitstate
@	clearflag FLAG_SYS_SPECIAL_WILD_BATTLE
	specialvar VAR_RESULT, GetBattleOutcome
	compare VAR_RESULT, B_OUTCOME_WON
	goto_if_eq MtEmber_Summit_EventScript_DefeatedMoltres
	compare VAR_RESULT, B_OUTCOME_RAN
	goto_if_eq MtEmber_Summit_EventScript_RanFromMoltres
	compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED
	goto_if_eq MtEmber_Summit_EventScript_RanFromMoltres
@	setflag FLAG_FOUGHT_MOLTRES
    removeobject VAR_LAST_TALKED
	release
	end

MtEmber_Summit_EventScript_DefeatedMoltres:: @ 8163B96
@	setflag FLAG_FOUGHT_MOLTRES
	goto EventScript_RemoveStaticMon
	end

MtEmber_Summit_EventScript_RanFromMoltres:: @ 8163B9F
	setvar VAR_0x8004, SPECIES_MOLTRES
	goto EventScript_MonFlewAway
	end

EventScript_RemoveStaticMon:: @ 81A922D
    fadescreen FADE_TO_BLACK
    removeobject VAR_LAST_TALKED
    fadescreen FADE_FROM_BLACK
    release
    end

EventScript_MonFlewAway:: @ 81A9236
    fadescreen FADE_TO_BLACK
    removeobject VAR_LAST_TALKED
    fadescreen FADE_FROM_BLACK
    bufferspeciesname 0, VAR_0x8004
    msgbox Text_MonFlewAway
    release
    end

Text_MonFlewAway:: @ 81A63C4
	.string "{STR_VAR_1}飞走了!$"

Text_Gyaoo:
    .string "这不是传说中的神奇宝贝\n"
    .string "火焰鸟吗？$"
